package Four;

import java.util.Scanner;

class IllegalScoreException extends Exception {

	public IllegalScoreException(String string) {
		super(string);
	}

}

class IllegalNameException extends RuntimeException {

	public IllegalNameException(String string) {
		super(string);
	}
}

class Student {
	private String name;
	private int score;

	public String getName() {
		return name;
	}

	public void setName(String name) throws IllegalNameException {
		if (Character.isDigit(name.charAt(0))) {
			throw new IllegalNameException("the first char of name must not be digit, name=" + name);
		} else {
			this.name = name;
		}
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	@Override
	public String toString() {
		return "Student [name=" + name + ", score=" + score + "]";
	}

	public int addScore(int score) throws IllegalScoreException {
		this.score += score;
		if (score < 0 || score > 100) {
			this.score -= score;
			throw new IllegalScoreException("score out of range, score=" + score);
		}
		System.out.println(this.toString());
		return score;
	}
}

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		while (scan.hasNext()) {
			String s = scan.next();
			if (s.equals("new")) {
				Student stu = new Student();
//				String s1=scan.nextLine();
//				Scanner scan1 = new Scanner(s1);
				try {
					String name=scan.next();
					stu.setName(name);
					stu.addScore(scan.nextInt());
				} catch (Exception e) {
					System.out.println(e);
				}
			}else{
				break;
			}
		}
		scan.close();
		System.out.println("scanner closed");

	}
}